<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
	<xsl:include href="core\form.xsl"/>
	<xsl:include href="core\layout_empty.xsl"/>
	<xsl:include href="core\common_templates.xsl"/>

	<xsl:template name="page_content">
		<table cellpadding="4" cellspacing="1" width="95%" align="center">
			<xsl:choose>
				<xsl:when test="string-length(/page/autherror)>0">
					<tr><td><xsl:apply-templates select="autherror"/></td></tr>
				</xsl:when>
				<xsl:otherwise>
					<tr>
						<td>
							<xsl:call-template name="title_page">
								<xsl:with-param name="titleText">Slide Show</xsl:with-param>
							</xsl:call-template>
   							<xsl:apply-templates select="vessel_photos"/>
						</td>
					</tr>
				</xsl:otherwise>
			</xsl:choose>
		</table>
	</xsl:template>

	<xsl:template match="vessel_photos">
		<table cellpadding="5" cellspacing="5" align="center">
			<tr>
				<td>
					<xsl:apply-templates select="photo[@current='0']"/>
				</td>
			</tr>
		</table>
		<table cellpadding="2" cellspacing="2" align="center">
			<tr>
				<td valign="middle"><xsl:call-template name="photo_prev"/></td>
				<td>&#160;&#160;</td>
				<td align="center">
					<table>
						<tr>
							<td class="titlebisection"><font color="{$color_main_first1}">
								<xsl:choose>
									<xsl:when test="string-length(photo[@current='1']/@alt)>0">
										<xsl:value-of select="photo[@current='1']/@alt"/>
									</xsl:when>	
									<xsl:otherwise>
										<xsl:value-of select="photo[@current='1']/@title"/>
									</xsl:otherwise>
								</xsl:choose></font>
							</td>
						</tr>
						<tr>
							<td>
								<img src="{$media_path}{photo[@current='1']}" border="1" style="border-color:{$color_main_first1};"/>
							</td>
						</tr>
					</table>
				</td>
				<td>&#160;&#160;</td>
				<td valign="middle"><xsl:call-template name="photo_next"/></td>
			</tr>
		</table>
		<hr width="80%" size="1" noshade="true" color="#CCCCCC"/>
		<table cellpadding="2" cellspacing="2" align="center">
			<tr>
				<td align="center"><a href="#" onClick="window.close();"><img src="{$img_path_templates}/{$header_bg_color}/buttons/btn_close.gif" border="0"/></a></td>
			</tr>
		</table>
	</xsl:template>

	<xsl:template match="photo">
		<td>
			<a>
				<xsl:choose>
					<xsl:when test="not(//page/form_id)">
						<xsl:attribute name="href">
							main.asp?-vessel_photos.asp-?vessel_id=<xsl:value-of select="//page/vessel"/>&amp;photo=<xsl:value-of select="@Id"/>
						</xsl:attribute>
						<img src="{$media_path}{.}">
							<xsl:choose>
								<xsl:when test="@alt = ''">
									<xsl:attribute name="alt"><xsl:value-of select="@title"/></xsl:attribute>
								</xsl:when>
								<xsl:otherwise>
									<xsl:attribute name="alt"><xsl:value-of select="@alt"/></xsl:attribute>
								</xsl:otherwise>
							</xsl:choose>
							<xsl:choose>
								<xsl:when test="@Id = //page/curr_photo">
									<xsl:attribute name="border">4</xsl:attribute>
									<xsl:attribute name="style">border-color:<xsl:value-of select="$color_main_first1"/>;</xsl:attribute>
								</xsl:when>
								<xsl:otherwise>
									<xsl:attribute name="border">0</xsl:attribute>
								</xsl:otherwise>
							</xsl:choose>
						</img>
					</xsl:when>
					<xsl:otherwise>
						<xsl:attribute name="href">
							main.asp?-vessel_photos.asp-?vessel_id=<xsl:value-of select="//page/vessel"/>&amp;photo=<xsl:value-of select="@Id"/>&amp;form_id=<xsl:value-of select="//page/form_id"/>
						</xsl:attribute>
						<img src="{$media_path}{.}">
							<xsl:choose>
								<xsl:when test="@alt = ''">
									<xsl:attribute name="alt"><xsl:value-of select="@title"/></xsl:attribute>
								</xsl:when>
								<xsl:otherwise>
									<xsl:attribute name="alt"><xsl:value-of select="@alt"/></xsl:attribute>
								</xsl:otherwise>
							</xsl:choose>
							<xsl:choose>
								<xsl:when test="@Id = //page/curr_photo">
									<xsl:attribute name="border">2</xsl:attribute>
									<xsl:attribute name="style">border-color:<xsl:value-of select="$color_main_first1"/>;</xsl:attribute>
								</xsl:when>
								<xsl:otherwise>
									<xsl:attribute name="border">0</xsl:attribute>
								</xsl:otherwise>
							</xsl:choose>
						</img>
					</xsl:otherwise>
				</xsl:choose>			
			</a>
		</td>
	</xsl:template>

	<xsl:template name="photo_next">
		<xsl:choose>
			<xsl:when test="not(//page/form_id)">
				<xsl:if test="photo_next">
					<a href="main.asp?-vessel_photos.asp-?vessel_id={//page/vessel}&amp;photo={photo_next}&amp;name={//page/vessel_name}">
						<img src="{$img_path_templates}/{$header_bg_color}/buttons/btn_next.gif" border="0" alt="next"/>
					</a>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="photo_next">
					<a href="main.asp?-vessel_photos.asp-?vessel_id={//page/vessel}&amp;photo={photo_next}&amp;form_id={//page/form_id}">
						<img src="{$img_path_templates}/{$header_bg_color}/buttons/btn_next.gif" border="0" alt="next"/>
					</a>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>

	<xsl:template name="photo_prev">
		<xsl:choose>
			<xsl:when test="not(//page/form_id)">
				<xsl:if test="photo_prev">
					<a href="main.asp?-vessel_photos.asp-?vessel_id={//page/vessel}&amp;photo={photo_prev}&amp;name={//page/vessel_name}">
						<img src="{$img_path_templates}/{$header_bg_color}/buttons/btn_prev.gif" border="0" alt="prev"/>
					</a>
				</xsl:if>
			</xsl:when>
			<xsl:otherwise>
				<xsl:if test="photo_prev">
					<a href="main.asp?-vessel_photos.asp-?vessel_id={//page/vessel}&amp;photo={photo_prev}&amp;form_id={//page/form_id}">
						<img src="{$img_path_templates}/{$header_bg_color}/buttons/btn_prev.gif" border="0" alt="prev"/>
					</a>
				</xsl:if>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
